package com.xbongbong.pro.domain.entity;

import com.xbongbong.paas.enums.DelEnum;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * @author 吴峰
 * @date 2021/03/03 14:22
 */
@Setter
@Getter
@ToString
public class LowCodeActionSettingEntity implements Serializable {
    private static final long serialVersionUID = 265545405300228710L;

    private Long id;

    private String corpid;

    private Long formId;

    private Integer saasMark;

    private Integer businessType;

    /**
     * 1:表单；2：字段级别
     */
    private Integer type;

    /**
     * 1:值改变；2：表单页面被展示时（onFromMounted ）；3：表单提交前（*数据校验前 可阻断表单提交）（beforeFromSubmit ）；4：表单提交后（afterFromSubmit ）
     */
    private Integer triggerTiming;

    /**
     * @see com.xbongbong.pro.enums.lowcode.LowCodeActionTypeEnum
     *
     */
    private Integer actionType;

    private String attr;

    private Integer fieldType;

    /**
     * 注册服务id
     */
    private Long serviceId;

    private String param;

    private Integer sort;

    private String creatorId;

    private Long addTime;

    private Long updateTime;

    private Integer del;

    public LowCodeActionSettingEntity(String corpid, Long formId, Integer saasMark, Integer businessType, Integer type, Integer triggerTiming, Integer actionType,
                                      String attr, Integer fieldType, Long serviceId, String param, Integer sort, String creatorId, Long addTime, Long updateTime) {
        this.corpid = corpid;
        this.formId = formId;
        this.saasMark = saasMark;
        this.businessType = businessType;
        this.type = type;
        this.triggerTiming = triggerTiming;
        this.actionType = actionType;
        this.attr = attr;
        this.fieldType = fieldType;
        this.serviceId = serviceId;
        this.param = param;
        this.sort = sort;
        this.creatorId = creatorId;
        this.addTime = addTime;
        this.updateTime = updateTime;
        this.del = DelEnum.NORMAL.getDel();
    }

    public LowCodeActionSettingEntity(Long id, Integer type, Integer triggerTiming, Integer actionType, String attr, Integer fieldType, Long serviceId, String param, Integer sort, Long updateTime) {
        this.id = id;
        this.type = type;
        this.triggerTiming = triggerTiming;
        this.actionType = actionType;
        this.attr = attr;
        this.fieldType = fieldType;
        this.serviceId = serviceId;
        this.param = param;
        this.sort = sort;
        this.updateTime = updateTime;
    }

    public LowCodeActionSettingEntity() {
        this.del = DelEnum.NORMAL.getDel();
    }
}
